package com.compass.doctor.ui.mine.adapter

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.compass.framework.model.ArticleInfo
import com.compass.doctor.R
import com.compass.doctor.databinding.LayoutInquiryRecordItemBinding
import com.compass.framework.adapter.BaseBindViewHolder
import com.compass.framework.adapter.BaseRecyclerViewAdapter
import com.compass.framework.glide.setUrlCircle
import com.compass.framework.manager.DictionariesManager
import com.compass.framework.model.InquiryOrder
import com.compass.framework.model.PatientISeeRecord
import com.compass.framework.utils.DateUtils
import com.compass.framework.utils.getDrawableResource
import com.compass.framework.utils.getStringFromResource
import java.text.SimpleDateFormat
import java.util.Locale

/**
 * Description： 问诊记录Adapter
 * Date:2023/11/16 14:11
 */
class InquiryRecordAdapter :
    BaseRecyclerViewAdapter<PatientISeeRecord, LayoutInquiryRecordItemBinding>() {


    override fun getViewBinding(
        layoutInflater: LayoutInflater,
        parent: ViewGroup,
        viewType: Int
    ): LayoutInquiryRecordItemBinding {
        return LayoutInquiryRecordItemBinding.inflate(layoutInflater, parent, false)
    }

    override fun onBindDefViewHolder(
        holder: BaseBindViewHolder<LayoutInquiryRecordItemBinding>,
        item: PatientISeeRecord?,
        position: Int
    ) {
        if (item == null) return
        holder.binding.apply {
            tvReceptionTime.text=DateUtils.conversionTime(item.createTime,DateUtils.FORMAT_TWO)
            tvInquiryType.text= DictionariesManager.getOrderConsultationTypeString(item.type)
            tvConsultationLength.text= DateUtils.secondToDate(item.consultationLength)
            item.clinicalDiagnosis?.let {
                tvDiagnoseContent.text=it
            }?:kotlin.run {
                tvDiagnoseContent.text="暂无诊断"
            }

            tvRemark.text=item.proposalMsg
            tvName.text = item.patientName
            tvAge.text = item.patientAge
            ivHead.setUrlCircle(item.patientAvatar)
            ivSex.background= if (item.patientSex==1) getDrawableResource(R.mipmap.icon_male) else  getDrawableResource(
                R.mipmap.icon_female)
        }
    }
}